import {Storage} from "@ionic/storage";
import { Injectable } from '@angular/core';


@Injectable()
export class UserSettingProvider {

  constructor(private storage:Storage) {
    
  }

  /**
   * 设置最后更新时间
   */
  setRefreshData():Promise<any>{
    return this.storage.set('updateTime',Date.now());
  }
  /**
   * 缓存是否需要更新
   */
  isRefreshData():Promise<boolean>{
    return this.storage.get('updateTime').then(value=>{
      return (Date.now()-value)/1000>24*60*60?true:false;
    });
  }
}
